package com.project.service.imp;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.project.bean.UserBean;
import com.project.mapper.IUserMapper;
import com.project.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class UserServiceImp implements IUserService {
    @Autowired
    private IUserMapper mapper;
    @Override
    public UserBean login(String userName, String pwd) {
        QueryWrapper qw = new QueryWrapper<>();
        qw.eq("u_name",userName);
        qw.eq("u_pwd",pwd);
        return mapper.selectOne(qw);
    }

    @Override
    public UserBean findByUser(String userName) {
        QueryWrapper qw = new QueryWrapper<>();
        qw.eq("u_name",userName);
        return mapper.selectOne(qw);
    }

    @Override
    public void add(UserBean userBean) {
        mapper.insert(userBean);
    }
}
